<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html">
   <h:head>
      <title>#{msgs.windowMenu}</title>
   </h:head>
   <h:outputStylesheet library="css" name="bootstrap.css"  />
   <h:body style="padding-left:10px">
   	  <h4>#{msgs.users}</h4>
   	  
      <h:form>
			<h:dataTable value="#{superMenu.temp}" var="userCred" frame="border" rules="all"
				styleClass="order-table" headerClass="order-table-header" 
         		rowClasses="order-table-odd-row,order-table-even-row" rendered = "#{superMenu.login.getActiveUser().isSuperUser()}">
			
            <h:column style="text-align:center">
               <f:facet name="header">
                  <h:outputText value="#{msgs.editColumn}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:selectBooleanCheckbox value="#{userCred.editable}" onclick="submit()"/>
            </h:column>
            
            <h:column style="text-align:left">
               <f:facet name="header">
                  <h:outputText value="#{msgs.username}"
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{userCred.username}" rendered="#{userCred.editable}" 
                            size="5" style="width: 40px"/>
               <h:outputText value="#{userCred.username}" rendered="#{not userCred.editable}"/>
            </h:column>
            
            <h:column style="text-align:left">
               <f:facet name="header">
                  <h:outputText value="#{msgs.password}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{userCred.password}" rendered="#{userCred.editable}" 
                            size="5" style="width: 40px"/>
               <h:outputText value="#{userCred.password}" rendered="#{not userCred.editable}"/>
            </h:column>
            
            <h:column style="text-align:left">
               <f:facet name="header">
                  <h:outputText value="#{msgs.full}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{userCred.fullname}" rendered="#{userCred.editable}" 
                            size="5" style="width: 40px"/>
               <h:outputText value="#{userCred.fullname}" rendered="#{not userCred.editable}"/>
            </h:column>
            
            <h:column style="text-align:left">
               <f:facet name="header">
                  <h:outputText value="#{msgs.eNum}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{userCred.eNumber}" rendered="#{userCred.editable}" 
                            size="5" style="width: 40px"/>
               <h:outputText value="#{userCred.eNumber}" rendered="#{not userCred.editable}"/>
            </h:column>
            <h:column style="text-align:left">
               <f:facet name="header">
                  <h:outputText value="#{msgs.delete}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:commandButton value="#{msgs.delete}" class="btn btn-small btn-danger"
                          action = "#{superMenu.delete(userCred)}" rendered="#{not userCred.isSuperUser()}"/>
            </h:column>
			</h:dataTable>
			<br />
			<div class="btn-group">
				<h:commandButton value="#{msgs.add}" class="btn btn-small btn-success"
                          action="#{superMenu.add}"/>
				<h:commandButton value="#{msgs.saveChangesButtonText}" class="btn btn-small btn-primary"
                          action="#{superMenu.save}"/>
                <h:commandButton value="#{msgs.view}" class="btn btn-small btn-primary"
                          action="index"/>
            	<h:commandButton value="Logout" class="btn btn-small btn-warning"
                          action="#{superMenu.logout}"/>
			</div>
      </h:form>
   </h:body>
</html>
